home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / ge_cool.lha / GE_COOL2.1 / src / String / char.h < prev    next >
C/C++ Source or Header  |  1992-04-13  |  4KB  |  102 lines

  1. //
  2. // Copyright (C) 1991 Texas Instruments Incorporated.
  3. //
  4. // Permission is granted to any individual or institution to use, copy, modify,
  5. // and distribute this software, provided that this complete copyright and
  6. // permission notice is maintained, intact, in all copies and supporting
  7. // documentation.
  8. //
  9. // Texas Instruments Incorporated provides this software "as is" without
  10. // express or implied warranty.
  11. //
  12. //
  13. // Created: MBN 04/04/89 -- Initial design and implementation
  14. // Updated: DKM 07/07/89 -- To work around Xenix 31 char limit:
  15. //                          Shortened is_less_than        to is_lt
  16. //                                    is_greater_than     to is_gt
  17. //                                    is_less_or_equal    to is_le
  18. //                                    is_greater_or_equal to is_ge
  19. // Updated: MBN 12/15/89 -- Made case-flag optional on is_equal, is_not_equal
  20. // Updated: DLS 03/22/91 -- New lite version
  21. //
  22. // This   header  file   defines function   prototypes   for extended    char*
  23. // functionality patterned after  that of the  CoolString class. This will allow a
  24. // programmer to chose char* or CoolString strings  for an application  based upon
  25. // the needs of the program and not the availability  of a particular function
  26. // or functions. Note  that there  is no attempt  to  allocate  or  deallocate
  27. // memory.  Functions for  comparison (both case  sensitive  and insensitive),
  28. // case conversion and  string  token  trimming are provided.   All  functions
  29. // assume pointer operands are passed.
  30. //
  31.  
  32. #ifndef CHARH            // If not yet defined,
  33. #define CHARH            // Indicate that char* header defined
  34.  
  35. #ifndef C_STRINGH
  36. #if defined(DOS)        // If String support not yet defined,
  37. extern "C" {
  38. #include <string.h>        // Include standard string header file
  39. }
  40. #else
  41. #include <string.h>        // Include standard string header file
  42. #endif
  43. #define C_STRINGH
  44. #endif
  45.  
  46. #ifndef STREAMH            // If the Stream support not yet defined,
  47. #if defined(DOS) || defined(M_XENIX)
  48. #include <stream.hxx>        // include the Stream class header file
  49. #else
  50. #include <stream.h>        // include the Stream class header file
  51. #endif
  52. #define STREAMH
  53. #endif
  54.  
  55. #ifndef MISCELANEOUSH                // If no misc.h file
  56. #include <misc.h>            // Include useful defintions
  57. #endif    
  58.  
  59. void reverse (char*);        // Reverse character order in string
  60.  
  61. extern Boolean is_equal_n (const char*, const char*, int n,
  62.                Boolean case_flag=INSENSITIVE);
  63.  
  64. extern Boolean is_equal (const char*, const char*,
  65.              Boolean case_flag=INSENSITIVE);
  66.  
  67. extern Boolean is_not_equal (const char*, const char*,
  68.                  Boolean case_flag=INSENSITIVE);
  69.  
  70. extern Boolean is_lt (const char*, const char*, Boolean);
  71. extern Boolean is_gt (const char*, const char*, Boolean);
  72. extern Boolean is_le (const char*, const char*, Boolean);
  73. extern Boolean is_ge (const char*, const char*, Boolean);
  74.  
  75. extern char* c_trim (char*, const char*);    // Trim characters from string
  76. extern char* c_left_trim (char*, const char*);    // Trim prefix characters
  77. extern char* c_right_trim (char*, const char*);    // Trim suffix characters
  78.  
  79. extern char* c_upcase (char*);            // Convert string to upper case
  80. extern char* c_downcase (char*);        // Convert string to lower case
  81. extern char* c_capitalize (char*);        // Capitalize each word 
  82. extern const char* strfind (const char*, const char*,
  83.                 long* start=0, long* end=0);
  84. extern const char* strrfind (const char*, const char*,
  85.                  long* start=0, long* end=0);
  86. extern char* strnremove (char*, long);
  87. extern char* strndup (const char*, long);
  88. extern char* strnyank (char*, long);
  89.  
  90. #if defined(DOS)        // ANSI definition is correct, and small
  91. #define TO_LOWER tolower
  92. #define TO_UPPER toupper
  93. #else                // Else make a fast version
  94. extern const char downcharmap[256];
  95. #define TO_LOWER(x) downcharmap[x]
  96. extern const char upcharmap[256];
  97. #define TO_UPPER(x) upcharmap[x]
  98. #endif
  99.  
  100. #endif                        // End #ifdef of CHARH
  101.  
  102.